//
//  NBUtils.h
//
//  Created by 曹燃 on 15-1-23.
//  Copyright (c) 2015年 feiyu.com. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AdSupport/ASIdentifierManager.h>
#import <UIKit/UIKit.h>

@interface FYUtils : NSObject

// JSON字符串解析成NSDictionary
+ (NSDictionary*) fyJsonToDictionary:(NSString *)inputText;

//Dictionary编码成json
+ (NSString*)fyDictionaryToJson:(NSDictionary *)dic;

//Json--> Array
+ (NSArray*)arrayWithJsonString:(NSString*)jsonString;

//MD5 字符串加密
+ (NSString*) fyMd5Encrypt:(NSString *)inputText;

// 1.dictionary按key排序 2.组合URL参数字符串 3.URL编码 4.生成签名
+ (NSString*) fyGenerateSign:(NSDictionary *)dict secret:(NSString *)secret;

// URL编码
+ (NSString*) fyUrlEncode:(NSString*)string;

//URL解码
+ (NSString*)fyUrlDecode:(NSString*)str;

// URL参数字符串解析成dictionary
+ (NSDictionary*)fyUrlParameterToDictionary:(NSString*)str;

//dictionary转成URL参数字符串
+ (NSString*) fyDictionaryToParameter:(NSDictionary*)dict;

// 获取IDFA
+ (NSString*) fyGetIdfa;

// 获取IDFV
+ (NSString*) fyGetIdfv;

// 生成设备ID
+ (NSString*) fyGenerateDeviceId;

//屏幕宽
+ (CGFloat) fyScreenWidth;

//屏幕长
+ (CGFloat) fyScreenHeight;

////是否横屏
//+ (BOOL)fyIsLandscape;
//
////是否竖屏
//+ (BOOL)fyIsPortrait;

//获取时间戳
+ (NSString*)fyGetTimeStamp;

//获取系统时间(yyyyMMddHHmmss)
+ (NSString*)fyGetSystemTime;

//数组排序
+ (NSArray*)fySortArray:(NSArray*)array;

//去除string中的空格
+ (NSString*)fyRemoveWhiteSpace:(NSString*)string;

//测试注册的邮箱或者电话号码是否符合要求
+ (BOOL)fyIsValidateEmailAndTel:(NSString*) inputText;

//判断有没有空格
+ (BOOL)fyHasWhiteSpace:(NSString*)string;

//限制字符串长度
+ (NSString*)fyLimitStringLength:(NSString*)str length:(NSInteger)length;

//根据颜色生成相应的图片
+ (UIImage *)fyImageWithColor:(UIColor *)color;

//根据十六进制色值生成颜色
+ (UIColor*)fyColorWithHexString:(NSString*)hex alpha:(CGFloat)alpha;

//屏幕截图
+ (void)fyScreenShot;

//获取当前屏幕显示的viewcontroller
+ (UIViewController *)fyGetCurrentVC;

@end
